/**
 * Copyright (2017, ) Institute of Sofeware, Chinese Academy of Sciences
 * 
 */
package cn.abcsys.devops.commons.utils;

import cn.abcsys.devops.application.model.ApplicationCore;
import cn.abcsys.devops.application.model.ParamsApplication;

/**
 * @author wuheng(wuheng@otcaix.iscas.ac.cn)
 * @date   Jul 10, 2017
 *
 */
public class NumberUtils {

	/**
	 * @param number
	 * @return
	 */
	public static boolean isValid(Integer number) {
		return (number >= 0 && number <= Integer.MAX_VALUE) ? true : false;
	}

	public static boolean resetEnvId(ParamsApplication pa){
		if(pa!=null && pa.envId !=null){
			if(pa.applicationCore == null){
				pa.applicationCore = new ApplicationCore();
			}
			if(pa.envId == 0)
				pa.applicationCore.setApplicationRuntimeId(null);
			else
				pa.applicationCore.setApplicationRuntimeId(pa.envId);
			return true;
		}
		return false;
	}
}
